//
//  YHYAddViewCollectionViewCell.m
//  Home
//
//  Created by 杨泓晔 on 16/5/3.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "YHYAddViewCollectionViewCell.h"

@implementation YHYAddViewCollectionViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return self;
}


- (void)creatView{
   
_myLabel = [UILabel new];
_myLabel.userInteractionEnabled = YES;
// self.contentView.userInteractionEnabled = YES;
_myLabel.textColor = ZI;
_myLabel.layer.borderColor = KH.CGColor;
_myLabel.textAlignment = NSTextAlignmentCenter;
_myLabel.font = [UIFont fontWithName:TFont size:TEXTNAMEFONT * AUTO_WIDTH];
//  self.contentView.backgroundColor = LV;
[self.contentView addSubview:_myLabel];
[_myLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.mas_equalTo(self);
    make.centerX.mas_equalTo(self.mas_centerXWithinMargins);
    make.height.mas_equalTo(self);
    
}];
    
    
    _myImageView = [UIImageView new];
    [self.contentView addSubview:_myImageView];
   // _myImageView.image = [UIImage imageNamed:@"myRight"];
    [_myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_myLabel.mas_centerYWithinMargins);
        make.right.mas_equalTo(self.contentView).offset(-156/3 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(50/2 * AUTO_WIDTH, 50/2 *AUTO_HEIGHT));
        
    }];

}

- (void)setContentStr:(NSString *)contentStr {
    
    _contentStr = contentStr;
    self.myLabel.text = _contentStr;
   
}


- (void)changeColor:(BOOL)isChange {
    if (isChange) {
        [UIView animateWithDuration:0.3 animations:^{
            //  UIView *view = [self.myLabel.subviews objectAtIndex:1];
            //    view.backgroundColor = [UIColor blackColor]
           // self.myLabel.backgroundColor = GH;
            self.myLabel.textColor = GH;
            _myImageView.image = [UIImage imageNamed:@"myRight"];
        }];
    }
    else {
        self.myLabel.backgroundColor = [UIColor whiteColor];
        _myLabel.textColor = ZI;
       //_myImageView.image = [UIImage imageNamed:@"myRight"];
        
    }
    
    
    
}

@end
